<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  <script src="node_modules/jquery/dist/jquery.min.js"></script>
  <script src="node_modules/lodash/lodash.min.js"></script>
  <script src="node_modules/zrender/dist/zrender.min.js"></script>
  <script src="src/topology-zrender.js"></script>
  <script src="src/topology-zrender-tools.js"></script>
</head>

<body>
  <div id="topologyGraph" style="width: 100%;height: 100%"></div>
</body>
<script>
  var graph = topology.init(document.getElementById('topologyGraph'));
  getData().then(function(dataList) {


    var options = {
      data: dataList,
      dataTitle: function(data) { //default: 'title'
        return data.name
      },
      dataText: 'name',
      style: {
        drawingBoard: {
          width: $('#topologyGraph').width()
        },
        node: {
          bgColor: '#a5b9cc', //default: '#a5b9cc'
          textColor: '#fff', //default: '#fff'
          width: 120, //default: 120
          height: 25 //default: 25
        }
      }
    };

    var nodeList = topologyTools.recursionGraphNodeData(options);
    graph.create(nodeList);
  });

  graph.on('click', function(params) {
    alert('graph.click');
  });
  function getData() {
    return $.ajax({ url: 'src/data-type.json', dataType: "json" })
  }
</script>

</html>